//
//  meViewController.swift
//  EY.Mtel_ProjectTemplate_Swift
//
//  Created by zxj on 2020/8/11.
//  Copyright © 2020 EY.Mtel. All rights reserved.
//

import UIKit

class meViewController: BaseViewController {
    @IBOutlet weak var tableView: UITableView!
    override func viewDidLoad() {
        super.viewDidLoad()
        self.navigationItem.title = "ME"
        tableView.emptyDataSetSource = self
        tableView.emptyDataSetDelegate = self
        tableView.separatorColor = UIColor.clear
        let MemberShipCard = UINib(nibName: "HomeTableViewCell", bundle: nil)
        tableView.register(MemberShipCard, forCellReuseIdentifier: NSStringFromClass(HomeTableViewCell.self))
    }
}

extension meViewController:UITableViewDelegate,UITableViewDataSource{
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 0
    }
    
    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat{
        return 80
    }
    
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier:  NSStringFromClass(HomeTableViewCell.self), for: indexPath) as! HomeTableViewCell
        return cell
    }
}


extension meViewController:DZNEmptyDataSetSource,DZNEmptyDataSetDelegate{
    func image(forEmptyDataSet scrollView: UIScrollView!) -> UIImage! {
        return UIImage(named: "placeholder_remote")
    }
    func title(forEmptyDataSet scrollView: UIScrollView!) -> NSAttributedString! {
        return appendColorStrWithString(str:"网络不给力，请点击重试哦~" , font: 15, color: "#007EE5".toUIColor())
    }
    func emptyDataSet(_ scrollView: UIScrollView!, didTap view: UIView!) {
        print("emptyDataSet")
    }
    //传入字符串、字体、颜色      返回NSMutableAttributedString
     func appendColorStrWithString(str:String,font:CGFloat,color:UIColor) -> NSMutableAttributedString {
        var attributedString : NSMutableAttributedString
        let attStr = NSMutableAttributedString.init(string: str, attributes: [NSAttributedString.Key.font : UIFont.systemFont(ofSize: font),NSAttributedString.Key.foregroundColor:color])
        attributedString = NSMutableAttributedString.init(attributedString: attStr)
        return attributedString
    }
}
